<template>
  <div class="pagination">
    <div class="pager">
      <a-button style="margin: 0px">每页12条</a-button>
      <a-button>首页</a-button>
      <a-pagination
      :showSizeChanger="false"
        v-model:current="current"
        :total="total"
        :hideOnSinglePage="false"
        @change="onChange"
      >
        <template #itemRender="{ page, type, originalElement }">
          <a v-if="type === 'prev'">上一页</a>
          <a v-else-if="type === 'next'">下一页</a>
          <renderVNode v-else :vnode="originalElement"></renderVNode>
        </template>
      </a-pagination>
      <a-button>末页</a-button>
      <span>[共10页/100条数据]</span>
    </div>
    <div class="go">
      第 <a-input v-model="jump"></a-input> 页
      <a-button style="background: #ef6410">GO</a-button>
    </div>
  </div>
</template>
<script setup>
  import { defineComponent, ref, watch, reactive } from 'vue';
  const current = ref(1);
  const size = ref(10);
  const total = ref(200);
  const onChange = (count) => {
    console.log('Page: ', count);
    current.value = count;
  };
  const showSizeChange = (size) => {
    size.value = size;
  };
  function renderVNode(_, { attrs: { vnode } }) {
    return vnode;
  }
</script>
<style scoped lang="less">
  .pagination {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16rem;
    box-sizing: border-box;
    border-top: 1rem solid #d1d1d1;

    /deep/.pager {
      flex: 1;
      display: flex;
      align-items: center;
      font-weight: 400;
      font-size: 14px;
      color: #6d6d6d;
      .ant-pagination-item {
        width: 61rem;
        height: 36rem;
        line-height: 36rem;
        background: #ffffff;
        border-radius: 4rem;
        border: 1rem solid #888888;
      }
      .ant-pagination-item-active {
        color: #fff !important;
        border-color: #ef6410;
        background-color: #ef6410;
        a {
          color: #fff !important;
        }
        &:hover a {
          color: #fff !important;
        }
      }
      .ant-btn {
        margin: 8rem;
        height: 36rem;
        width: 120rem !important;
        background-color: transparent;
        background-color: #fff;
      }
      .ant-btn:hover {
        color: #ef6410;
        border-color: #ef6410;
      }
      .ant-pagination-prev,
      .ant-pagination-next {
        width: 120rem;
        height: 36rem;

        color: #000;
        background: #ffffff;
        border-radius: 4rem;
        border: 1rem solid #888888;
        a {
          color: #000 !important;
        }
      
      }
      .is-active {
        background-color: #ef6410 !important;
        color: #fff;
      }
    }
    .go {
      display: flex;
      align-items: center;
      font-family: Microsoft YaHei;
      font-weight: 400;
      font-size: 14px;
      color: #6d6d6d;
      /deep/ .ant-input {
        width: 80px;
        margin: 0 8px;
        border: 1px solid #ddd !important;
        text-align: center;
      }
      .ant-btn {
        margin: 8px;
        color: #fff;
      }
      .ant-btn:hover {
        border-color: #ef6410;
      }
    }
  }
</style>
